//
//  ImageReportView.m
//  ZITHER
//
//  Created by imac on 2018/5/16.
//  Copyright © 2018年 MS1968. All rights reserved.
//

#import "ImageReportView.h"
#define kKEY_WINDOW [UIApplication sharedApplication].keyWindow

@interface ImageReportView ()
@property (weak, nonatomic) IBOutlet UIView *bgView;
@property (weak, nonatomic) IBOutlet UIButton *confirmButton;
@property (weak, nonatomic) IBOutlet UIImageView *reportImageView;

@end
@implementation ImageReportView
+ (instancetype)instanceWithFrame:(CGRect)frame {
    ImageReportView *view = (ImageReportView *)[[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:self options:nil] firstObject];
    view.frame = frame;
    return view;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    
}
- (void)show {
    [kKEY_WINDOW addSubview:self];
}
- (void)remove {
    [self removeFromSuperview];
}

- (IBAction)confirmClick:(UIButton *)sender {
    if (self.removeBlock) {
        [self remove];
        self.removeBlock();
    }
}
#pragma mark - Setter
- (void)setReportImage:(UIImage *)reportImage {
    _reportImage = reportImage;
    _reportImageView.image = _reportImage;
}
- (void)setConfirmButton:(UIButton *)confirmButton {
    _confirmButton = confirmButton;
    [_confirmButton setCornerRadiusWithRadius:2 isMasks:YES];
    [_confirmButton setBorderWithColor:[UIColor blackColor] width:1];
}
- (void)setBgView:(UIView *)bgView {
    _bgView = bgView;
    [_bgView setCornerRadiusWithRadius:4 isMasks:YES];
}
@end
